home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
2614.ZIP
/
TBROWS.ZIP
/
TTBR1.PRG
next >
Wrap
Text File
|
1990-10-22
|
2KB
|
93 lines
/*****
*
* TTBR1.PRG
* First example for TBROWSE class using a database file
*
* 18 October 90
* Luiz Quintela - Nantucket Corp
*
* Clipper ttbr1 /N/W/A/B
* RTLINK FILE ttbr1 PLL base50
*
*/
// Include Header Files
// This will make handling keystrokes
// a bit easier!
#include "inkey.ch"
FUNCTION Main()
// Your variables
LOCAL b, column, nKey
SET SCOREBOARD OFF
SET DATE BRITISH
SET CONFIRM ON
// First open your file, with indexes, etc.
USE test INDEX test NEW // Use NEW in lieu of SELECT 0
// Prepare a beautiful color screen
// I do not like to put several commands in a single line
// but this is just to show what you can do with Clipper
SETCOLOR( "BG/B,GR+/B,,,BG/N" ); CLS
// Ok! Now is time to create a TBrowseDB object
// TBrowseDB( top, left, bottom, right ) ===> Object
b := TBrowseDB( 2, 2, 20, 78)
// Note that TBrowseDB() creates an object with no column
// objects. In order to make the object usable, a column must be
// added for each field to display.
// In this example we will use three fields.
// TBColumnNew( cHeading, bBlock ) =====> Object
column := TBColumnNew( "Field 1", {|| test->fld1} )
// Returns a new column object with specified heading and data
// retrieval block
b:addColumn( column )
// addColumn( objColumn ) =====> self
// Adds a new column object to the browse object and
// TBrowse:colCount is increased by one.
// Repeat the same to other fields
column := TBColumnNew( "Field 2", {|| test->fld2} )
b:addColumn( column )
column := TBColumnNew( "Field 3", {|| test->fld3} )
b:addColumn( column )
// It is time to put this programme to work
WHILE .T.
// Ok! It is time to stabilize display
// stabilize() =====> self
// Performs incremental stabilization. Stabilization is
// performed in increments so that it can be interrupted
// by any asynchronous event.
// A value of .T. is returned indicating the object is stable
WHILE ( !b:stabilize() )
nKey := InKey()
IF ( nKey != 0 )
EXIT // abort if a key is waiting
ENDIF
END
// b:stable contains .T. if the browse object is stable
// Display is stable
IF ( b:stable ) // everything's done; just wait for a key
nKey := INKEY(0)
ENDIF
QUIT
END
/* EOF - TTBR1.PRG */